package com.yao.grpcdemo.test;

import com.yao.grpcdemo.grpc.GRpcService;
import com.yao.grpcdemo.proto.GreeterGrpc;
import com.yao.grpcdemo.proto.GreeterService.HelloRequest;
import io.grpc.stub.StreamObserver;

@GRpcService
public class GreeterService extends GreeterGrpc.GreeterImplBase {
    public GreeterService() {
        System.out.println("service create....");
    }

    @Override
    public void sayHello(HelloRequest request, StreamObserver<com.yao.grpcdemo.proto.GreeterService.HelloReply> responseObserver) {
        System.out.println("hello" + request.getName());
        responseObserver.onNext(com.yao.grpcdemo.proto.GreeterService.HelloReply.newBuilder().setMessage("ok").build());
        responseObserver.onCompleted();
    }
}
